﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

/// <summary>
/// Represents true/false values by image
/// </summary>
public partial class YesNoInfo : System.Web.UI.UserControl
{
    /// <summary>
    /// Gets or sets a value indicating whether this <see cref="YesNoInfo"/> is value.
    /// </summary>
    /// <value><c>true</c> if value; otherwise, <c>false</c>.</value>
    public bool Value 
    {
        get
        {
            if (ViewState["YesNoInfoValue"] != null)
            {
                return (bool)ViewState["YesNoInfoValue"];
            }
            return false;
        }
        set
        {
            ViewState["YesNoInfoValue"] = value;
        }
    }

    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    /// <summary>
    /// Handles the PreRender event of the Page control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void Page_PreRender(object sender, EventArgs e)
    {
        this.ImageTrue.Visible = this.Value;
        this.ImageFalse.Visible = !this.Value;    
    }
}
